package com.soulless.threadlocal;

/**
 * @author zenglei
 * @Description 功能描述
 * 在同一个线程里是唯一的，线程隔离
 * @date 2022/11/17 01:02
 */
public class ThreadLocalSingleton {

    private static final ThreadLocal<ThreadLocalSingleton> threadLocalInstance = new ThreadLocal<ThreadLocalSingleton>() {
        @Override
        protected ThreadLocalSingleton initialValue() {
            return new ThreadLocalSingleton();
        }
    };

    private ThreadLocalSingleton() {}

    public static ThreadLocalSingleton getInstance() {
        return threadLocalInstance.get();
    }

}
